package top.topsmart.api.bycenter.controller;

import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import top.topsmart.api.bycenter.service.DynamicService;
import top.topsmart.api.bycenter.service.UserOperationService;
import top.topsmart.api.bycenter.util.Result;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Api(tags = "用户操作")
@RestController
@RequestMapping(value = "operation", method = {RequestMethod.GET, RequestMethod.POST})

public class OperationController {
    @Autowired
    private UserOperationService userOperationService;

    @PostMapping("operate")
    @ApiOperation("operate")
    public Result operate(@RequestBody JSONObject operation) {
        System.out.println(new SimpleDateFormat("yyy-MM-dd hh:mm:ss").format(new Date()) + "  正在处理operation/operate");
        return userOperationService.operate(operation);
    }

    @PostMapping("getDynamicDetail")
    @ApiOperation("getDynamicDetail")
    public Result getDynamicDetail(@RequestBody JSONObject param) {
        System.out.println(new SimpleDateFormat("yyy-MM-dd hh:mm:ss").format(new Date()) + "  正在处理operation/getDynamicDetail");
        return userOperationService.getDynamicDetail(param);
    }

    @PostMapping("update")
    @ApiOperation("update")
    public Result update(@RequestBody JSONObject param) {
        System.out.println(new SimpleDateFormat("yyy-MM-dd hh:mm:ss").format(new Date()) + "  正在处理operation/getDynamicDetail");
        return userOperationService.update(param);
    }
}
